//
//  CSGXProgressTool.m
//  CarSalesMS_GCX
//
//  Created by Ssky on 2016/11/16.
//  Copyright © 2016年 Tony. All rights reserved.
//

#import "CSGXProgressTool.h"

@interface CSGXProgressTool ()


@end

@implementation CSGXProgressTool

//+ (instancetype)shared {
//    static id _instance = nil;
//    static dispatch_once_t onceToken;
//    dispatch_once(&onceToken, ^{
//        _instance = [[self alloc] init];
//    });
//    return _instance;
//}


+ (void)showMsgWithStatus:(NSString *)msg delay:(NSTimeInterval)interval {
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    [SVProgressHUD showWithStatus:msg];
    
    if (interval == -1) {
        return;
    }
    
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        [NSThread sleepForTimeInterval:interval];
        [SVProgressHUD dismiss];
    });
}

+ (void)showSuccessWithStatus:(NSString *)msg delay:(NSTimeInterval)interval {
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    [SVProgressHUD showSuccessWithStatus:msg];
    
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        [NSThread sleepForTimeInterval:interval];
        [SVProgressHUD dismiss];
    });
}

+ (void)showErrorWithStatus:(NSString *)errorStr delay:(NSTimeInterval)interval {
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    [SVProgressHUD showErrorWithStatus:errorStr];
    
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        [NSThread sleepForTimeInterval:interval];
        [SVProgressHUD dismiss];
    });
}


@end
